/**
 * 应用主体
 * 1.初始化应用
 * 2.初始化界面
 * 3.初始化数据
 * @author CheMingbing
 * @since 18/04/15
 */
import * as React from 'react';
import BasicLayout from 'containers/basic-layout';
import { BrowserRouter, HashRouter, Switch, Route } from 'react-router-dom';
import Authorized from 'utils/authorized';
import Login from 'pages/login';

const { AuthorizedRoute } = Authorized;

function App(): any {
  // 创建布局
  return (
    <HashRouter>
      <Switch>
        <Route exact path="/login" component={Login} />
        <AuthorizedRoute
          path="/"
          render={props => <BasicLayout {...props} />}
          authority={['admin', 'user']}
          redirectPath="/login"
        />
      </Switch>
    </HashRouter>
  );
}

export default App;
